#include<bits/stdc++.h>
using namespace std;
#define LL long long
LL rd(){
    LL x=0,f=1;
    char c = getchar();
    while(c<'0'||c>'9'){
        if(c=='-') f=-1;
        c = getchar();
    }
    while(c>='0'&&c<='9'){
        x = (x<<3)+(x<<1)+(c^48);
        c = getchar();
    }
    return x*f;
}
const int N = 1e5+5;
int t[N],v[N],a[N];
void solve(){
    int n = rd();
    int mx = 0 , mn = 10*N;
    for(int i=1;i<=n;i++){
        a[i] = rd();
        t[a[i]]++;
        mx = max(mx,a[i]);
        mn = min(mn,a[i]);
    }
    int l=mn;
    for(int i=mn;i<=mx;i++){
        if(!t[i]) continue;
        int cnt = t[i];
        while(cnt>0&&l<i){
            while(l<i&&!t[l]) l++;
            if(i==l) break;
            if(t[l]<=cnt) cnt-=t[l],t[l]=0;
            else{
                t[l]-=cnt;
                cnt=0;
            }
        }
    }
    int res=0;
    for(int i=1;i<=mx;i++) res += t[i];
    cout<<res<<'\n';
}
int main(){
    freopen("duel.in","r",stdin);
    freopen("duel.out","w",stdout);
    solve();
    return 0;
}
